package com.controller.ningdong;

import com.entity.*;
import com.service.ningdong.impl.SynthesizeQueryServiceImpl;
import com.util.gzp.AjaxResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
/**
 * 综合查询
 */
@Controller
@ResponseBody
@RequestMapping("/synthesize")
public class SynthesizeQueryController {

    @Autowired
    private SynthesizeQueryServiceImpl synthesizeQueryService;

    /**
     * 所有权查询
     * @param synthesizeQuery
     * @return
     */
    @RequestMapping("/ownership")
    @ResponseBody
    public AjaxResponse ownership(SynthesizeQuery synthesizeQuery) {
        String clientname=synthesizeQuery.getOwner();
        String idcard=synthesizeQuery.getIdcard();

        System.out.println("-----------------"+clientname+idcard);
        List<OwnershipQuery> ownershipQueryList = synthesizeQueryService.ownership(clientname, idcard);

        System.out.println("*******************"+ownershipQueryList);
        return AjaxResponse.success(ownershipQueryList,"233323");
    }

    /**
     * 他项权查询
     * @param synthesizeQuery
     * @return
     */
    @RequestMapping("/mortgage")
    public AjaxResponse mortgage(SynthesizeQuery synthesizeQuery){
        String mortgager = synthesizeQuery.getPawnor();
        String mortgageridcard = synthesizeQuery.getPawnoridcard();
        String mortgagee = synthesizeQuery.getMortgagee();
        String mortgageeidcard = synthesizeQuery.getMortgageeidcard();

        List<MortgageQuery> mortgageQueryList = synthesizeQueryService.mortgage(mortgager, mortgageridcard, mortgagee, mortgageeidcard);
        System.out.println("------------"+mortgageQueryList);
        return  AjaxResponse.success(mortgageQueryList,"233333");
    }

    /**
     * 查封信息查询
     * @param synthesizeQuery
     * @return
     */
    @RequestMapping("/seal")
    public AjaxResponse seal(SynthesizeQuery synthesizeQuery){
        String roomnumber = synthesizeQuery.getRoomnumber();
        SealQuery sealQuery = synthesizeQueryService.seal(roomnumber);
        System.out.println("------------"+sealQuery);
        return  AjaxResponse.success(sealQuery,"233333");
    }


    /**
     * 异议查询
     * @param keyword
     * @return
     */
    @RequestMapping("/dissentingregistration")
    public AjaxResponse dissentingregistration(String keyword){

        List<DiffrentQuery>  diffrentQueryList =  synthesizeQueryService.dissentingregistration(keyword);
        System.out.println("------------"+diffrentQueryList);
        return  AjaxResponse.success(diffrentQueryList,"233333");
    }








}
